- truncate_at ||= 35
- select_id ||= 'snapshot-selector'
- backlog_root = @backlog.backlog_root || @backlog

=form_tag :url => '#' do
  %select.snapshot-selector{:id => select_id}
    %option
      Working version (current)
    - if backlog_root.snapshots.blank?
      %optgroup{ :label => "No manual snapshots..." }
    - else
      %optgroup{ :label => "Manual snapshots..." }
        - backlog_root.snapshots.each do |snapshot|
          %option{:class => 'manual', :value => snapshot.id, :selected => (snapshot == @backlog ? true : false) }= "#{truncate(snapshot.name, :length => truncate_at)}, #{backlog_date snapshot}"
    - if backlog_root.sprint_snapshots.blank?
      %optgroup{ :label => "No sprint snapshots..." }
    - else
      %optgroup{ :label => "Sprint snapshots..." }
        - backlog_root.sprint_snapshots.each do |snapshot|
          %option{:class => 'sprint', :value => snapshot.id, :selected => (snapshot == @backlog ? true : false) }= "#{truncate(snapshot.name, :length => truncate_at)}, #{backlog_date snapshot}"